<?php 
	class MapsModel
	{
		function __construct()
		{

		}
		function is_set_location($image_id)
		{
			global $wpdb;
			$query=$wpdb->prepare("SELECT * FROM ".$wpdb->prefix.'image_maps WHERE image_id=%d ',$image_id);
			$row=$wpdb->get_results($query);
			if($row) return 1;
			else return 0;
		}
		function save_location($image_id,$latlgn,$address)
		{
			global $wpdb;
			$wpdb->insert( 
					$wpdb->prefix.'image_maps',
					array( 'image_id' => $image_id, 'location' => $latlgn ,'address'=>$address), 
					array( '%d' ,'%s','%s')
				);

		}
		function update_location($image_id,$latlgn,$address)
		{	
			global $wpdb;
			$wpdb->update( 
					$wpdb->prefix.'image_maps', 
					array( 
						'location' => $latlgn,
						'address'=>$address
					), 
					array( 'image_id' => $image_id ), 
					array('%s','%s'),
					array( '%s' )
				);
		}
	}
 ?>